package peer.servertcp;

import peer.tools.ByteIntSwitch;
import peer.tools.ByteShortSwitch;

public class TunnelReceiveBufferedMessageTCP {
	byte[] data;
	int tunnelId;
	int bufferedSize;
	short messageType=MessageTCP.type_ReceiveBuffredMessage;
	TunnelReceiveBufferedMessageTCP(int tunnelId,int bufferedSize){
		data=new byte[6];
		ByteIntSwitch.toByteArray(tunnelId, data, 0);
		ByteShortSwitch.toByteArray((short) bufferedSize, data, 4);
	}
	
	TunnelReceiveBufferedMessageTCP(byte[] rData){
		tunnelId=ByteIntSwitch.toInt(rData, 0);
		bufferedSize=ByteShortSwitch.toShort(rData, 4);
	}
	
	int getBufferedSize(){
		return bufferedSize;
	}
	
	int getTunnelId(){
		return tunnelId;
	}
	
	public byte[] getData(){
		return data;
	}
	
	public int getLength(){
		return data.length;
	}
	
	public short getMessageType(){
		return messageType;
	}
}
